-module(cust_inst).
-include("rec_dec.hrl").
-export([start/1]).

start(C) ->
    spawn(fun() -> loop(C) end).

loop(C) ->
    receive
        {go_forward} ->
            loop(go_forward(C));
        {pick} ->
            loop(pick(C));
        {stop} ->
            {stop}
    end.

go_forward(C)->
    C#cust_in_q_rec{loc = C#cust_in_q_rec.loc + 1}.

pick(C) ->
    C#cust_in_q_rec{loc=0,state=picket}.
